home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- // This example code is from the book:
- //
- // Object-Oriented Programming with C++ and OSF/Motif
- // by
- // Douglas Young
- // Prentice Hall, 1992
- // ISBN 0-13-630252-1
- //
- // Copyright 1991 by Prentice Hall
- // All Rights Reserved
- //
- // Permission to use, copy, modify, and distribute this software for
- // any purpose except publication and without fee is hereby granted, provided
- // that the above copyright notice appear in all copies of the software.
- ///////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
-
-
- /////////////////////////////////////////////////////////////
- // ColorTestWindow.C: Test the ColorChooser dialog
- /////////////////////////////////////////////////////////////
- #include <stdio.h>
- #include "ColorTestWindow.h"
- #include "ColorChooser.h"
- #include <Xm/PushB.h>
-
- Widget ColorTestWindow::createWorkArea ( Widget parent )
- {
- _button = XtCreateWidget ( "push_to_test",
- xmPushButtonWidgetClass,
- parent,
- NULL, 0 );
-
- XtAddCallback ( _button,
- XmNactivateCallback,
- &ColorTestWindow::pickColorCallback,
- (XtPointer) this );
-
- _colorChooser = new ColorChooser ( parent, "colorChooser" );
-
- return _button;
- }
-
- void ColorTestWindow::pickColorCallback ( Widget,
- XtPointer clientData,
- XtPointer )
- {
- ColorTestWindow *obj = ( ColorTestWindow * ) clientData;
- ColorChooser *colorChooser = obj->_colorChooser;
-
- colorChooser->pickColor ( &ColorTestWindow::colorSelectedCallback,
- NULL,
- NULL );
- }
-
- void ColorTestWindow::colorSelectedCallback ( int red,
- int green,
- int blue,
- void * )
- {
- printf ( "Color Chosen: \n\
- red = %d, \n\
- green = %d,\n\
- blue = %d\n",
- red, green, blue );
- }
-